-- card: 3067 from stack: in -- bmap block id: 0 -- flags: 0000 -- background id: 2747 -- name: -- part 14 (button) -- low flags: 00 -- high flags: A000 -- rect: left=406 top=164 right=221 bottom=502 -- title width / last selected line: 0 -- icon id / first selected line: 1 / 1 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Further Info ----- HyperTalk script ----- on mouseUp show cd fld moreInfo end mouseUp -- part 12 (button) -- low flags: 00 -- high flags: A000 -- rect: left=406 top=94 right=151 bottom=502 -- title width / last selected line: 0 -- icon id / first selected line: 20965 / 20965 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: About RTF Maker ----- HyperTalk script ----- on mouseUp ShowDialog 1,300,"",False,1,8 end mouseUp -- part 9 (button) -- low flags: 00 -- high flags: 8004 -- rect: left=166 top=21 right=41 bottom=238 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: RTF Style ----- HyperTalk script ----- on mouseDown put ",b,i,ul,up6\fs18,dn6\fs18,outl,shad,scaps,caps,v,strike,ulw,uldb,uld" into RTFlist get PopUp ("©1988SDrazga",160,rect of me) if it is 0 then exit mouseDown if the selection is empty then exit mouseDown put it into styleNo if StyleNo is 1 then removeFormats exit mouseDown end if if it is 0 then exit mouseDown put item styleNo of RTFlist into RTFSymb addFormat RTFSymb end mouseDown -- part 2 (field) -- low flags: 00 -- high flags: 0007 -- rect: left=31 top=73 right=335 bottom=377 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: theText -- part 4 (button) -- low flags: 00 -- high flags: 2000 -- rect: left=0 top=318 right=342 bottom=33 -- title width / last selected line: 0 -- icon id / first selected line: 1011 / 1011 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Go Home ----- HyperTalk script ----- on mouseUp Go Home end mouseUp -- part 5 (button) -- low flags: 00 -- high flags: A004 -- rect: left=66 top=20 right=71 bottom=144 -- title width / last selected line: 0 -- icon id / first selected line: 200 / 200 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Make RTF File ----- HyperTalk script ----- on mouseUp get NewFileName("Name of new RTF file", "New.RTF") if it is empty then exit mouseUp set cursor to 4 put it into theFile open file theFile put cd fld theText into tex repeat -- replace CR's with \par put offset (return, tex) into theRet if theRet is 0 then exit repeat put "\par " into char theRet of tex end repeat write (cd fld RTFheader) to file theFile write tex to file theFile write "}" to file theFile close file theFile get ChangeFileType (theFile, "TEXT", "MSWD") end mouseUp -- part 6 (button) -- low flags: 00 -- high flags: 8004 -- rect: left=236 top=21 right=41 bottom=310 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Font ----- HyperTalk script ----- on mouseDown get the selectedChunk put it into theSel get PopUp ("©1988SDrazga",201,rect of me,x) if it is empty then exit mouseDown put it into fontName if the selection is empty then exit mouseDown find whole it in bg fld fontList put the foundLine into theLine if theLine is empty then put "Can't find" && fontName else get theLine put "f" & first word of the value of theLine into theFont select theSel addFormat theFont end if end mouseDown -- part 7 (button) -- low flags: 00 -- high flags: 8004 -- rect: left=308 top=21 right=41 bottom=382 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Size ----- HyperTalk script ----- function doOther ShowDialog 2,200,"","","","",1,1 get the result return it end doOther on mouseDown get PopUp ("©1988SDrazga",220,rect of me,x) if the selection is empty then exit mouseDown if it is empty then exit mouseDown put it into choice if offset("Other", choice) > 0 then put doOther() into choice if choice + 0 <= 0 then exit mouseDown put "fs" & (choice * 2) into theSize addFormat theSize end mouseDown -- part 1 (field) -- low flags: 80 -- high flags: 0007 -- rect: left=277 top=48 right=149 bottom=510 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 9 -- style flags: 0 -- line height: 12 -- part name: RTFHeader ----- HyperTalk script ----- On mouseUp hide me end mouseUp -- part 3 (button) -- low flags: 00 -- high flags: A000 -- rect: left=410 top=25 right=45 bottom=507 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Show Data ----- HyperTalk script ----- on mouseUp if the short name of me is "Show Data" then set the name of me to "Hide Data" Show cd fld RTFheader show bg fld fontList else hide cd fld RTFheader hide bg fld fontList set the name of me to "Show Data" end if end mouseUp -- part 16 (field) -- low flags: 81 -- high flags: 0007 -- rect: left=0 top=19 right=338 bottom=512 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: moreInfo ----- HyperTalk script ----- on mouseUp hide me end mouseUp -- part contents for card part 1 ----- text ----- {\rtf0\mac {\fonttbl{\f0\fswiss Chicago;}{\f2\froman New York;}{\f3\fswiss Geneva;}{\f4\fmodern Monaco;}{\f5\fscript Venice;}{\f6\fdecor London;}{\f13\fnil Princeton;}{\f14\fnil Bookman;}{\f15\fnil N Helvetica Narrow;}{\f16\fnil Palatino;} {\f18\fnil Zapf Chancery;}{\f20\froman Times;}{\f21\fswiss Helvetica;}{\f22\fmodern Courier;}{\f23\ftech Symbol;}{\f33\fnil Avant Garde;}{\f34\fnil New Century Schlbk;}{\f128\fnil B-New York;}{\f129\fnil Zapf Dingbats;}{\f193\fnil L Helvetica Light;} {\f200\fnil MF Symbols;}{\f203\fnil NY 48|72;}{\f230\fnil Alison;}}{\stylesheet{\f20\fs28 \sbasedon222\snext0 Normal;}}\widowctrl\ftnbj\ftnrestart \sectd \linemod0\linex0\cols1\colsx0\endnhere \pard\plain \f20\fs28 -- part contents for card part 2 ----- text ----- RTF Maker This stack demonstrates how you can use HyperCard to produce fully formatted Microsoft Word™ documents. This is often useful if you need to print data from HyperCard using various fonts, styles and sizes. The method makes use of Word's "rich text format", or RTF. Embedded code characters such as \ and are used to indicate font, size, and style information. To try it out, simply select text in this field and choose from the style, font and size menus above. When you do, the special RTF code symbols will be placed around your selected text. Here is a sample: This sentence is in Helvetica 18 point font, with some italics, some boldface, some outline-italic, some {\uldb double-underline text. Then hit the "Make RTF File" button to create a Word document. When you double-click on this document to invoke Word you will be asked if you wish to interpret the RTF code. You should answer YES. You can use this stack as is, or you can take it as a demonstration of how to do the same thing in your own stacks. If you want to put this capability into other stacks, be sure to move the MENU and XFCN {\b {\fs28 {\f16 resources that go with it. Also, there are two hidden data fields (you can see them by clicking the "Show Data" button). These contain information needed in the file's header and also the ID numbers of the various fonts.}}} If you use this stuff in your own stack, be sure to acknowledge the authors of the XFCNs and XCMDs that are used (see "About RTF Maker"). And of course, yours truly. Bill Engels   -- part contents for background part 1 ----- text ----- 33 Avant Garde 14 Bookman 0 Chicago 22 Courier 3 Geneva 21 Helvetica 6 London 4 Monaco 15 N Helvetica Narrow 34 New Century Schlbk 2 New York 16 Palatino 13 Princeton 23 Symbol 20 Times 5 Venice 18 Zapf Chancery 129 Zapf Dingbats -- part contents for card part 16 ----- text ----- Further Information -------------------- Word's RTF is just a plain text file with a special header defining the fonts, stylesheets, etc. that are used in the body of the text. When Word opens the file and detects the special code characters in the header, it interprets the body of the text (at your option) as an RTF file. The formatting codes always include the backslash (\) character and terminate with a space. There is a lot more that can be done in RTF than this little example demonstrates. For example, I haven't included any ruler information, graphics or stylesheet options in this stack. These things shouldn't be too hard to add if you need them. It's easy to discover the RTF codes for yourself just by setting up a document in Word 3.0, then saving it as RTF. Just select "Save As …" from the File menu and click on the Format button. Then choose "Interchange Format (RTF)" After you save the file, the rather messy looking RTF information will be on your screen for you to examine. The full header will also be there. If you want to use a different header from the one I have provided, simply copy your own RTF header and paste it into the "RTFheader" field. At the time of this writing version 4.0 of Word is not available. Therefore, I cannot say whether RTF will continue to be supported or whether it will undergo changes. However, since the purpose of RTF is for exchanging files with other word processing programs (mainly versions of Word on blue computers), it seems unlikely that the format will be abandoned anytime soon. Bill Engels 19 November 1988